const Controller = require('egg').Controller;

class ResourceController extends Controller {
    // 查询get请求
    async index() {
        try {
            let rsList = await this.ctx.service.resource.getRsList();
            this.ctx.body = {
                code: 20000,
                message: true,
                data: rsList
            }
        } catch (error) {
            this.ctx.body = {
                code: 30000,
                message: false,
            }
        }

    }
    async create() {
        try {
            let form = this.ctx.request.body.form;
            let rsList = await this.ctx.service.resource.postRsList(form);
            this.ctx.body = {
                code: 20000,
                message: true,
                data:rsList,
            }
        } catch (error) {
            this.ctx.body = {
                code: 30000,
                message: false,
            }
        }

    }
}
module.exports = ResourceController;